package com.sample
{
	import mx.controls.Alert;
	import mx.formatters.CurrencyFormatter;
	import mx.formatters.DateFormatter;
	import mx.formatters.NumberFormatter;
	import mx.utils.ObjectUtil;
	
	public class Defaults
	{
		public function Defaults()
		{
			if (instance != null) throw new Error("Only one instance of Defaults can exist. User Defaults.getInstance()");
			
			//initialization
			currencyFormatter.precision = 2;
			dateFormatter.formatString = "DD MMM YYYY";
			hoursFormatter.precision = 2;
		}
		
		private static var instance:Defaults;
		
		public static function getInstance():Defaults {
			if (instance == null) {
				instance = new Defaults();
			}
			return instance;
		}
		
		public var currencyFormatter:CurrencyFormatter = new CurrencyFormatter();
		public var dateFormatter:DateFormatter = new DateFormatter();
		public var hoursFormatter:NumberFormatter = new NumberFormatter();
		
		public static function errorHandler(err:Error):void {
			Alert.show(ObjectUtil.toString(err), "ERROR");
		}
		
		public var RemoteCall_authenticationRequired:Boolean = true;
		public var RemoteCall_showStatus:Boolean = true;

	}
}